﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CH.Easy.DbProvider.Core;
using System.Runtime.Remoting;

namespace CH.Easy.DbProvider.Entity
{

    public class QueryResult<T>
    {
       
        public int TotalRecord { get; set; }
        public int TotalPageRecord { get; set; }
        public int PageIndex { get; set; }
        public int PageSize { get; set; }
        public List<T> List { get; set; }
        public QueryResult(IEnumerable<T> source, int pageIndex, int pageSize, int totalRecord)
        {
            
            this.PageIndex = pageIndex;
            this.PageSize=pageSize;
            this.TotalRecord = totalRecord;
            if ((totalRecord % pageSize) > 0)
            {
                TotalPageRecord = totalRecord / pageSize + 1;
            }
            else 
            {
                TotalPageRecord = totalRecord / pageSize;
            }
            this.List = new List<T>(source);

        }


    }
}
